<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>mixin偷懒技术</title>
</head>
<body>
    <div id="app">
        {{msg}}
    </div>
    <script src="vue.js"></script>
    <script>
        const myMixin={
            data(){
                return{
                    msg:'123'
                }
            },
            created(){
                this.sayHello()
            },
            methods:{
                sayHello(){
                    console.log('hello mixin');
                }
            }
        }
        new Vue({
        el:'#app',
        data:{
            msg:"小胖子"
        },
        created(){
            console.log(111)
        },

        mixins:[myMixin]
        })
    </script>
</body>
</html>